package com.seth.myapplication;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.view.WindowManager;
import android.widget.LinearLayout;

import com.seth.myapplication.bean.User;
import com.seth.myapplication.helper.SetStatusTabHeight;
import com.seth.myapplication.surface.UserInfomation;


/**
 * Created by Seth on 2017/11/14.
 */

public class UsrInfoActivity extends FragmentActivity {
    private static final String EXTRA_USER_POSITION = "11111111";
    private User user;
    private FragmentManager fm;

    private LinearLayout topStatus;

    public static Intent newIntent(Context context,User u) {
        User r = u;
        Intent intent = new Intent(context,UsrInfoActivity.class);
        intent.putExtra(EXTRA_USER_POSITION, r);

        return intent;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
        setContentView(R.layout.activity_accept);

        Intent i = getIntent();
        user = (User) i.getSerializableExtra(EXTRA_USER_POSITION);

        initView();
        initEvent();
    }

    private void initEvent() {
        new SetStatusTabHeight(topStatus,this).setRelativeLayout();

        Fragment fragment = new UserInfomation();

        Bundle bundle = new Bundle();
        bundle.putSerializable(EXTRA_USER_POSITION,user);
        fragment.setArguments(bundle);


        fm = getSupportFragmentManager();
        // fragment = fm.findFragmentById(R.id.accept_content);
        fm.beginTransaction().add(R.id.accept_content, fragment).commit();
    }
    private void initView() {
        topStatus = (LinearLayout) findViewById(R.id.accept_top_sts);
    }



}
